package br.com.sgi.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.sgi.dao.EmailHistoricoDao;
import br.com.sgi.model.EmailHistorico;
import br.com.sgi.service.EmailHistoricoService;

@Service("emailHistoricoService")
public class EmailHistoricoServiceImpl implements EmailHistoricoService {

	@Autowired
	private EmailHistoricoDao emailHistoricoDao;



	@Override
	public EmailHistorico buscarUltimoHistoricoEmail(Long coMembro) {
			Map<String, Object> params = new java.util.HashMap<String, Object>();
			params.put("coMembro", coMembro);
			List<EmailHistorico> listEmailHistorico = emailHistoricoDao.findByNamedParamsNotIdSystem("buscarUltimoEmailHistorico", params);
			return listEmailHistorico.size() > 0 ? listEmailHistorico.get(0) : null;


	}



	@Override
	public void salvar(EmailHistorico emailHistorico) {
		emailHistoricoDao.save(emailHistorico);
		
	}

}
